﻿using Payroll.BusinessLogic.CustomerManager;
using Payroll.Common.Utils;
using PayrollHR.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PayrollHR.Administration.Modules
{
    public partial class CustomerInfo2 : BasePayrollAdministrationUserControl
    {
        public int CustomerID
        {
            get
            {
                return CommonHelper.QueryStringInt("CustomerId");
            }
        }
        public void BindCustomer(Customer item)
        {
            if (CommonHelper.IsNull(item))
                return;
            txtbusiness.Text = item.businesstype;
            txtRealEstate.Text = item.busRealEstateInfo;
            txtTax.Value = CommonHelper.ToDec(item.busRealMonthlyTax ?? "0");
            txtincome.Value = CommonHelper.ToDec(item.busMontlyIncome ?? "0");
            txtOrther.Text = item.busOther;
            //yeu cau khach hang
            txtrequirements.Text = item.requirements;
            // Giai thich yeu cau visa
            cbLevel.Checked = item.requirements_learning;
            cbAccoutNumber.Checked = item.requirements_accountNumber;
            cbDemonstrateIncome.Checked = item.requirements_income;
            cbConstraintConditions.Checked = item.requirements_conditions;
            cbFinan.Checked = item.requirements_financial;
            cbWorking.Checked = item.requirements_work;
            cbResponsibility.Checked = item.requirements_responsibility;
            txtMarketing.Text = item.marketing;
            txtResults.Text = item.marketing_results;
            /// thanh toan
            txtFirst.Text = item.payment_1;
            txtSecond.Text = item.payment_2;
            txtSTK.Text = item.payment_accountNumber;
            txtTC.Text = item.payment_financial;
            txtAN.Text = item.payment_AN;
            txtGD.Text = item.payment_GD;
            txtPVVISA.Text = item.payment_PV_VISA;
            txtOther1.Text = item.payment_Orther_1;
            txtlblOther2.Text = item.payment_Orther_2;
            txtOther3.Text = item.payment_Orther_3;
            txtSub1.Text = item.payment_Sub_1;
            txtSub2.Text = item.payment_Sub_2;
            txtTotal.Text = item.payment_Total;
            txtPlan.Text = item.plan_plan;
            txtNote.Text = item.Note_note;
        }
        public Customer GetCustomer(Customer customer)
        {
            customer.businesstype = txtbusiness.Text;
            customer.busRealEstateInfo = txtRealEstate.Text;
            customer.busRealMonthlyTax = CommonHelper.ToString(txtTax.Value);
            customer.busMontlyIncome = CommonHelper.ToString(txtincome.Value);
            customer.busOther = txtOrther.Text;
            //yeu cau khach hang
            customer.requirements = txtrequirements.Text;
            // Giai thich yeu cau visa
            customer.requirements_learning = cbLevel.Checked;
            customer.requirements_accountNumber = cbAccoutNumber.Checked;
            customer.requirements_income = cbDemonstrateIncome.Checked;
            customer.requirements_conditions = cbConstraintConditions.Checked;
            customer.requirements_financial = cbFinan.Checked;
            customer.requirements_work = cbWorking.Checked;
            customer.requirements_responsibility = cbResponsibility.Checked;
            customer.marketing = txtMarketing.Text;
            customer.marketing_results = txtResults.Text;
            /// thanh toan
            customer.payment_1 = txtFirst.Text;
            customer.payment_2 = txtSecond.Text;
            customer.payment_accountNumber = txtSTK.Text;
            customer.payment_financial = txtTC.Text;
            customer.payment_AN = txtAN.Text;
            customer.payment_GD = txtGD.Text;
            customer.payment_PV_VISA = txtPVVISA.Text;
            customer.payment_Orther_1 = txtOrther.Text;
            customer.payment_Orther_2 = txtlblOther2.Text;
            customer.payment_Orther_3 = txtOther3.Text.Trim();
            customer.payment_Sub_1 = txtSub1.Text.Trim();
            customer.payment_Sub_2 = txtSub2.Text.Trim();
            customer.payment_Total = txtTotal.Text.Trim();
            customer.plan_plan = txtPlan.Text.Trim() ;
            customer.Note_note = txtNote.Text.Trim();

            return customer;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { }
        }
    }
}